<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" 
    import="java.util.List"
    import="quizman.domain.*"
    %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View Quiz</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<%
	Quiz quiz = (quizman.domain.Quiz)request.getAttribute("quiz");
	List<Question> questions = quiz.getQuestions();
%>
<body>
<p class="quiz-name">Name of Quiz:  <%= quiz.getName() %></p>
<p>This quiz will last <%=quiz.getLength() %> minutes.</p>
<% if(questions==null){ %>
	<p class="no-questions">This quiz has no questions.</p>
<% }else{ %>
<form name="<%= quiz.getName() %>"><ol>
<% 
for(Question question : questions) {
%>
	<li>
		<p class="question-text"><%=question.getText() %></p>
		<p class="question-name">Question name: <%= question.getName() %></p>
		<%=question.getFormHtml() %>
	</li>
<%
}
%>
</ol>
<br><br>
<input type="reset" value="Reset"> <input type="submit" value="Submit">
</form>
<% } %>
<br>
<p><a href="EditQuizPageController?quizName=<%=quiz.getName() %>">Edit</a> this quiz.</p>
<p>Return to the <a href="<%= request.getContextPath() %>/">index</a> or <a href="ViewAllQuizPageController">all quizzes</a>.</p>
</body>
</html>